import styles from './index.less';
import React from 'react';
import { Layout, Menu, Dropdown, Icon, Avatar, ConfigProvider } from 'antd';
// 由于 antd 组件的默认文案是英文，所以需要修改为中文
import zhCN from 'antd/es/locale/zh_CN';
import moment from 'moment';
import 'moment/locale/zh-cn';
import Header from 'components/common/Header';
import Beian from 'components/common/Beian';
import Lmenu from 'components/common/Lmenu';
import Breadcrumb from 'components/common/Breadcrumb';
import Logo from 'components/common/Logo';
moment.locale('zh-cn');
const { Content, Sider, Footer } = Layout;

class BasicLayout extends React.Component {

  render() {
    const { props } = this;

    if (props.location.pathname.indexOf('/auth/login') > -1) {
      return (
        <ConfigProvider locale={zhCN}>
          <Layout style={{ background: "transparent" }}>{props.children}</Layout>
        </ConfigProvider>
      );
    }
    return (
      // 使用中文布局
      <ConfigProvider locale={zhCN}>
        <Layout>
          <Sider className={styles.jwsider}>
            <Logo></Logo>
            <Lmenu></Lmenu>
          </Sider>
          <Layout style={{ marginLeft: 200, minHeight: "100vh" }}>
            <Header></Header>
            <Content style={{ margin: '16px 16px 0', overflow: 'initial' }}>

              <div style={{ marginBottom: "10px" }}>
                <Breadcrumb></Breadcrumb>
              </div>

              <div style={{ padding: 16, background: '#fff', textAlign: 'center', borderRadius: "8px" }}>
                {props.children}
              </div>
            </Content>
            <Footer style={{ textAlign: 'center' }}>
              <Beian></Beian>
            </Footer>
          </Layout>
        </Layout>
      </ConfigProvider>
    );
  };

}

// ReactDOM.render(<BasicLayout />, document.getElementById('root'));

export default BasicLayout;
